package o;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;

public class daf {
    private static final String ˊ = (ContentManager.getInstant().getContext().getPackageName() + ".update");
    private static final String ˏ = (ContentManager.getInstant().getContext().getPackageName() + ".appinfos");
    private static final Uri ॱ = Uri.parse("content://" + ˏ + "/" + "item" + "/" + 17);

    private static void ˏ(Context context, int i) {
        czi.ˎ.ˋ("BroadcastToEMUI", "sendNumToEMUI EMUI SIZE =" + i);
        Intent intent = new Intent(ˊ);
        Bundle bundle = new Bundle();
        bundle.putInt("hispace_extra_update", i);
        intent.putExtra("hispace_extra_data", bundle);
        context.sendBroadcast(intent);
    }

    public static synchronized void ˎ(Context context, int i) {
        synchronized (daf.class) {
            boolean ˊ = ((czp) dbn.ˎ(czp.class)).ˊ();
            czi.ˎ.ˋ("BroadcastToEMUI", "update size change :" + i + ",display:" + ˊ);
            if (ˊ) {
                if (ˏ(context)) {
                    ˋ(context, cjl.ˋ("main.activity"), i);
                } else {
                    context.getContentResolver().notifyChange(ॱ, null);
                    ˏ(context, i);
                }
            }
        }
    }

    public static boolean ˏ(Context context) {
        boolean z = false;
        try {
            Bundle bundle = new Bundle();
            bundle.putString(HiAnalyticsConstant.BI_KEY_PACKAGE, context.getPackageName());
            bundle = context.getContentResolver().call(Uri.parse("content://com.huawei.android.launcher.settings/badge/"), "checkcancallbadge", "", bundle);
            if (bundle != null) {
                z = bundle.getBoolean("callbadge");
            }
        } catch (IllegalArgumentException e) {
            czi.ˎ.ˋ("BroadcastToEMUI", "can not checkcancallbadge" + e.getMessage());
        } catch (Exception e2) {
            czi.ˎ.ˋ("BroadcastToEMUI", "can not checkcancallbadge" + e2.getMessage());
        }
        return z;
    }

    public static void ˋ(Context context, Class cls, int i) {
        if (cls != null) {
            Bundle bundle = new Bundle();
            bundle.putString(HiAnalyticsConstant.BI_KEY_PACKAGE, context.getPackageName());
            bundle.putString("class", cls.getName());
            bundle.putInt("badgenumber", i);
            try {
                context.getContentResolver().call(Uri.parse("content://com.huawei.android.launcher.settings/badge/"), "change_badge", null, bundle);
            } catch (IllegalArgumentException e) {
                czi.ˎ.ˊ("BroadcastToEMUI", "can not change_badge, IllegalArgumentException");
            } catch (Exception e2) {
                czi.ˎ.ˊ("BroadcastToEMUI", "can not change_badge, " + e2.toString());
            }
        }
    }

    public static void ॱ(Context context) {
        ˏ(context, dak.ˏ().ˋ());
    }
}
